/***
*
* File: weaponsbuy.nut
* Auth: Damian Wojdat
* Date: 20.10.2012
* Desc: Handle weapon shop.
*
*************************************************************************************************************/

local weaponWindow = {};
local text = GUIFont("tahoma-bold", 10);	// player status text font
const DEFAULT_STATUS_TEXT = "Click weapon image to buy weapon and some ammo.";

function onMakeWeaponBuyBox()
{
	local y = 90.0;
	
	weaponWindow.window <- GUIWindow(); 
	weaponWindow.window.setText("Weapon shop"); 
	weaponWindow.window.setVisible(false); 
	weaponWindow.window.setSize(720.0, 790.0, false); 
	weaponWindow.window.setPosition(0.3, 0.3, true);

	weaponWindow.buttonWeapons <- GUIButton(); 
	weaponWindow.buttonWeapons.setText("Weapons"); 
	weaponWindow.buttonWeapons.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonWeapons.setVisible(true); 
	weaponWindow.buttonWeapons.setSize(90.0, 28.0, false); 
	weaponWindow.buttonWeapons.setPosition(19.0, 17.0, false); 

	weaponWindow.buttonAmmo <- GUIButton(); 
	weaponWindow.buttonAmmo.setText("Ammunition"); 
	weaponWindow.buttonAmmo.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonAmmo.setVisible(true); 
	weaponWindow.buttonAmmo.setSize(90.0, 28.0, false); 
	weaponWindow.buttonAmmo.setPosition(119.0, 17.0, false); 
	weaponWindow.buttonAmmo.setProperty("Disabled", "true"); 
	
	weaponWindow.textCash <- GUIText(); 
	weaponWindow.textCash.setText("Cash: $"); 
	weaponWindow.textCash.setParent(weaponWindow.window.getName()); 
	weaponWindow.textCash.setVisible(true); 
	weaponWindow.textCash.setSize(600.0, 15.0, false); 
	weaponWindow.textCash.setPosition(219.0, 19.0, false); 
	
	weaponWindow.textCashValue <- GUIText(); 
	weaponWindow.textCashValue.setText("0"); 
	weaponWindow.textCashValue.setParent(weaponWindow.window.getName()); 
	weaponWindow.textCashValue.setVisible(true); 
	weaponWindow.textCashValue.setSize(600.0, 15.0, false); 
	weaponWindow.textCashValue.setPosition(279.0, 19.0, false); 

	// Slot 1
	
	weaponWindow.textSlot1 <- GUIText(); 
	weaponWindow.textSlot1.setText("Slot 1 "); 
	weaponWindow.textSlot1.setParent(weaponWindow.window.getName()); 
	weaponWindow.textSlot1.setVisible(true); 
	weaponWindow.textSlot1.setSize(100.0, 15.0, false); 
	weaponWindow.textSlot1.setPosition(2.5, 90.0, false); 

	weaponWindow.imageFrame1 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame1.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame1.setVisible(true); 
	weaponWindow.imageFrame1.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame1.setPosition(48.0, y-5.0, false); 

	weaponWindow.imageFrame2 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame2.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame2.setVisible(true); 
	weaponWindow.imageFrame2.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame2.setPosition(218.0, y-5.0, false); 

	weaponWindow.imageFrame3 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame3.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame3.setVisible(true); 
	weaponWindow.imageFrame3.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame3.setPosition(388.0, y-5.0, false); 

	weaponWindow.imageBat <- GUIImage("bat.png"); 
	weaponWindow.imageBat.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageBat.setVisible(true); 
	weaponWindow.imageBat.setSize(150.0, 70.0, false); 
	weaponWindow.imageBat.setPosition(53.0, y+0.0, false); 

	weaponWindow.imagePoolCue <- GUIImage("poolcue.png"); 
	weaponWindow.imagePoolCue.setParent(weaponWindow.window.getName()); 
	weaponWindow.imagePoolCue.setVisible(true); 
	weaponWindow.imagePoolCue.setSize(150.0, 70.0, false); 
	weaponWindow.imagePoolCue.setPosition(223.0, y+0.0, false); 

	weaponWindow.imageKnife <- GUIImage("knife.png"); 
	weaponWindow.imageKnife.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageKnife.setVisible(true); 
	weaponWindow.imageKnife.setSize(150.0, 70.0, false); 
	weaponWindow.imageKnife.setPosition(393.0, y+0.0, false); 

	weaponWindow.buttonBat <- GUIButton(); 
	weaponWindow.buttonBat.setText("bat"); 
	weaponWindow.buttonBat.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonBat.setVisible(true); 
	weaponWindow.buttonBat.setSize(150.0, 70.0, false); 
	weaponWindow.buttonBat.setPosition(53.0, y+0.0, false); 
	weaponWindow.buttonBat.setAlpha(0.0);

	weaponWindow.buttonPoolCue <- GUIButton(); 
	weaponWindow.buttonPoolCue.setText("poolcue"); 
	weaponWindow.buttonPoolCue.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonPoolCue.setVisible(true); 
	weaponWindow.buttonPoolCue.setSize(150.0, 70.0, false); 
	weaponWindow.buttonPoolCue.setPosition(223.0, y+0.0, false); 
	weaponWindow.buttonPoolCue.setAlpha(0.0);

	weaponWindow.buttonKnife <- GUIButton(); 
	weaponWindow.buttonKnife.setText("knfie"); 
	weaponWindow.buttonKnife.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonKnife.setVisible(true); 
	weaponWindow.buttonKnife.setSize(150.0, 70.0, false); 
	weaponWindow.buttonKnife.setPosition(393.0, y+0.0, false); 
	weaponWindow.buttonKnife.setAlpha(0.0);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("15$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(128.0, y+75.0, false);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("10$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(298.0, y+75.0, false);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("20$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(468.0, y+75.0, false);
	
	// Slot 2
	
	y += 100.0
	
	weaponWindow.textSlot2 <- GUIText(); 
	weaponWindow.textSlot2.setText("Slot 2 "); 
	weaponWindow.textSlot2.setParent(weaponWindow.window.getName()); 
	weaponWindow.textSlot2.setVisible(true); 
	weaponWindow.textSlot2.setSize(100.0, 15.0, false); 
	weaponWindow.textSlot2.setPosition(2.5, y+2.0, false); 

	weaponWindow.imageFrame4 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame4.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame4.setVisible(true); 
	weaponWindow.imageFrame4.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame4.setPosition(48.0, y-5.0, false); 

	weaponWindow.imageFrame5 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame5.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame5.setVisible(true); 
	weaponWindow.imageFrame5.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame5.setPosition(223.0, y-5.0, false); 

	weaponWindow.imagePistol <- GUIImage("pistol.png"); 
	weaponWindow.imagePistol.setParent(weaponWindow.window.getName()); 
	weaponWindow.imagePistol.setVisible(true); 
	weaponWindow.imagePistol.setSize(150.0, 70.0, false); 
	weaponWindow.imagePistol.setPosition(53.0, y+0.0, false); 

	weaponWindow.imageCombatPistol <- GUIImage("combatpistol.png"); 
	weaponWindow.imageCombatPistol.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageCombatPistol.setVisible(true); 
	weaponWindow.imageCombatPistol.setSize(150.0, 70.0, false); 
	weaponWindow.imageCombatPistol.setPosition(223.0, y+0.0, false); 

	weaponWindow.buttonPistol <- GUIButton(); 
	weaponWindow.buttonPistol.setText("pistol"); 
	weaponWindow.buttonPistol.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonPistol.setVisible(true); 
	weaponWindow.buttonPistol.setSize(150.0, 70.0, false); 
	weaponWindow.buttonPistol.setPosition(53.0, y+0.0, false); 
	weaponWindow.buttonPistol.setAlpha(0.0);

	weaponWindow.buttonCombatPistol <- GUIButton(); 
	weaponWindow.buttonCombatPistol.setText("combatpistol"); 
	weaponWindow.buttonCombatPistol.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonCombatPistol.setVisible(true); 
	weaponWindow.buttonCombatPistol.setSize(150.0, 70.0, false); 
	weaponWindow.buttonCombatPistol.setPosition(223.0, y+0.0, false); 
	weaponWindow.buttonCombatPistol.setAlpha(0.0);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("120$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(128.0, y+75.0, false);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("160$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(298.0, y+75.0, false);
	
	// Slot 3
	
	y += 100.0
	
	weaponWindow.textSlot2 <- GUIText(); 
	weaponWindow.textSlot2.setText("Slot 3 "); 
	weaponWindow.textSlot2.setParent(weaponWindow.window.getName()); 
	weaponWindow.textSlot2.setVisible(true); 
	weaponWindow.textSlot2.setSize(100.0, 15.0, false); 
	weaponWindow.textSlot2.setPosition(2.5, y+2.0, false); 

	weaponWindow.imageFrame6 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame6.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame6.setVisible(true); 
	weaponWindow.imageFrame6.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame6.setPosition(48.0, y-5.0, false); 

	weaponWindow.imageFrame7 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame7.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame7.setVisible(true); 
	weaponWindow.imageFrame7.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame7.setPosition(223.0, y-5.0, false); 

	weaponWindow.imageMicroSmg <- GUIImage("microsmg.png"); 
	weaponWindow.imageMicroSmg.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageMicroSmg.setVisible(true); 
	weaponWindow.imageMicroSmg.setSize(150.0, 70.0, false); 
	weaponWindow.imageMicroSmg.setPosition(53.0, y+0.0, false); 

	weaponWindow.imageSmg <- GUIImage("smg.png"); 
	weaponWindow.imageSmg.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageSmg.setVisible(true); 
	weaponWindow.imageSmg.setSize(150.0, 70.0, false); 
	weaponWindow.imageSmg.setPosition(223.0, y+0.0, false); 

	weaponWindow.buttonMicroSmg <- GUIButton(); 
	weaponWindow.buttonMicroSmg.setText("MicroSmg"); 
	weaponWindow.buttonMicroSmg.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonMicroSmg.setVisible(true); 
	weaponWindow.buttonMicroSmg.setSize(150.0, 70.0, false); 
	weaponWindow.buttonMicroSmg.setPosition(53.0, y+0.0, false); 
	weaponWindow.buttonMicroSmg.setAlpha(0.0);

	weaponWindow.buttonSmg <- GUIButton(); 
	weaponWindow.buttonSmg.setText("Smg"); 
	weaponWindow.buttonSmg.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonSmg.setVisible(true); 
	weaponWindow.buttonSmg.setSize(150.0, 70.0, false); 
	weaponWindow.buttonSmg.setPosition(223.0, y+0.0, false); 
	weaponWindow.buttonSmg.setAlpha(0.0);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("220$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(128.0, y+75.0, false);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("280$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(298.0, y+75.0, false);
	
	// Slot 4
	
	y += 100.0
	
	weaponWindow.textSlot2 <- GUIText(); 
	weaponWindow.textSlot2.setText("Slot 4 "); 
	weaponWindow.textSlot2.setParent(weaponWindow.window.getName()); 
	weaponWindow.textSlot2.setVisible(true); 
	weaponWindow.textSlot2.setSize(100.0, 15.0, false); 
	weaponWindow.textSlot2.setPosition(2.5, y+2.0, false); 

	weaponWindow.imageFrame8 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame8.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame8.setVisible(true); 
	weaponWindow.imageFrame8.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame8.setPosition(48.0, y-5.0, false); 

	weaponWindow.imageFrame9 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame9.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame9.setVisible(true); 
	weaponWindow.imageFrame9.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame9.setPosition(223.0, y-5.0, false); 

	weaponWindow.imageShotgun <- GUIImage("shotgun.png"); 
	weaponWindow.imageShotgun.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageShotgun.setVisible(true); 
	weaponWindow.imageShotgun.setSize(150.0, 70.0, false); 
	weaponWindow.imageShotgun.setPosition(53.0, y+0.0, false); 

	weaponWindow.imageCombatShotgun <- GUIImage("combatshotgun.png"); 
	weaponWindow.imageCombatShotgun.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageCombatShotgun.setVisible(true); 
	weaponWindow.imageCombatShotgun.setSize(150.0, 70.0, false); 
	weaponWindow.imageCombatShotgun.setPosition(223.0, y+0.0, false); 

	weaponWindow.buttonShotgun <- GUIButton(); 
	weaponWindow.buttonShotgun.setText("shotgun"); 
	weaponWindow.buttonShotgun.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonShotgun.setVisible(true); 
	weaponWindow.buttonShotgun.setSize(150.0, 70.0, false); 
	weaponWindow.buttonShotgun.setPosition(53.0, y+0.0, false); 
	weaponWindow.buttonShotgun.setAlpha(0.0);

	weaponWindow.buttonCombatShotgun <- GUIButton(); 
	weaponWindow.buttonCombatShotgun.setText("combatshotgun"); 
	weaponWindow.buttonCombatShotgun.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonCombatShotgun.setVisible(true); 
	weaponWindow.buttonCombatShotgun.setSize(150.0, 70.0, false); 
	weaponWindow.buttonCombatShotgun.setPosition(223.0, y+0.0, false); 
	weaponWindow.buttonCombatShotgun.setAlpha(0.0);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("260$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(128.0, y+75.0, false);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("300$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(298.0, y+75.0, false);
	
	// Slot 5
	
	y += 100.0
	
	weaponWindow.textSlot2 <- GUIText(); 
	weaponWindow.textSlot2.setText("Slot 5 "); 
	weaponWindow.textSlot2.setParent(weaponWindow.window.getName()); 
	weaponWindow.textSlot2.setVisible(true); 
	weaponWindow.textSlot2.setSize(100.0, 15.0, false); 
	weaponWindow.textSlot2.setPosition(2.5, y+2.0, false); 

	weaponWindow.imageFrame10 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame10.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame10.setVisible(true); 
	weaponWindow.imageFrame10.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame10.setPosition(48.0, y-5.0, false); 

	weaponWindow.imageFrame11 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame11.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame11.setVisible(true); 
	weaponWindow.imageFrame11.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame11.setPosition(223.0, y-5.0, false); 

	weaponWindow.imageAk47 <- GUIImage("ak47.png"); 
	weaponWindow.imageAk47.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageAk47.setVisible(true); 
	weaponWindow.imageAk47.setSize(150.0, 70.0, false); 
	weaponWindow.imageAk47.setPosition(53.0, y+0.0, false); 

	weaponWindow.imageM4 <- GUIImage("m4.png"); 
	weaponWindow.imageM4.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageM4.setVisible(true); 
	weaponWindow.imageM4.setSize(150.0, 70.0, false); 
	weaponWindow.imageM4.setPosition(223.0, y+0.0, false); 

	weaponWindow.buttonAk47 <- GUIButton(); 
	weaponWindow.buttonAk47.setText("ak47"); 
	weaponWindow.buttonAk47.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonAk47.setVisible(true); 
	weaponWindow.buttonAk47.setSize(150.0, 70.0, false); 
	weaponWindow.buttonAk47.setPosition(53.0, y+0.0, false); 
	weaponWindow.buttonAk47.setAlpha(0.0);

	weaponWindow.buttonM4 <- GUIButton(); 
	weaponWindow.buttonM4.setText("m4"); 
	weaponWindow.buttonM4.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonM4.setVisible(true); 
	weaponWindow.buttonM4.setSize(150.0, 70.0, false); 
	weaponWindow.buttonM4.setPosition(223.0, y+0.0, false); 
	weaponWindow.buttonM4.setAlpha(0.0);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("350$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(128.0, y+75.0, false);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("400$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(298.0, y+75.0, false);
	
	// Slot 6
	
	y += 100.0
	
	weaponWindow.textSlot2 <- GUIText(); 
	weaponWindow.textSlot2.setText("Slot 5 "); 
	weaponWindow.textSlot2.setParent(weaponWindow.window.getName()); 
	weaponWindow.textSlot2.setVisible(true); 
	weaponWindow.textSlot2.setSize(100.0, 15.0, false); 
	weaponWindow.textSlot2.setPosition(2.5, y+2.0, false); 

	weaponWindow.imageFrame12 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame12.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame12.setVisible(true); 
	weaponWindow.imageFrame12.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame12.setPosition(48.0, y-5.0, false); 

	weaponWindow.imageFrame13 <- GUIImage("frame.png"); 
	weaponWindow.imageFrame13.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageFrame13.setVisible(true); 
	weaponWindow.imageFrame13.setSize(160.0, 80.0, false); 
	weaponWindow.imageFrame13.setPosition(223.0, y-5.0, false); 

	weaponWindow.imageSniper <- GUIImage("sniperrifle.png"); 
	weaponWindow.imageSniper.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageSniper.setVisible(true); 
	weaponWindow.imageSniper.setSize(150.0, 70.0, false); 
	weaponWindow.imageSniper.setPosition(53.0, y+0.0, false); 

	weaponWindow.imageCombatSniper <- GUIImage("combatsniper.png"); 
	weaponWindow.imageCombatSniper.setParent(weaponWindow.window.getName()); 
	weaponWindow.imageCombatSniper.setVisible(true); 
	weaponWindow.imageCombatSniper.setSize(150.0, 70.0, false); 
	weaponWindow.imageCombatSniper.setPosition(223.0, y+0.0, false); 

	weaponWindow.buttonSniper <- GUIButton(); 
	weaponWindow.buttonSniper.setText("sniper"); 
	weaponWindow.buttonSniper.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonSniper.setVisible(true); 
	weaponWindow.buttonSniper.setSize(150.0, 70.0, false); 
	weaponWindow.buttonSniper.setPosition(53.0, y+0.0, false); 
	weaponWindow.buttonSniper.setAlpha(0.0);

	weaponWindow.buttonCombatSniper <- GUIButton(); 
	weaponWindow.buttonCombatSniper.setText("combatsniper"); 
	weaponWindow.buttonCombatSniper.setParent(weaponWindow.window.getName()); 
	weaponWindow.buttonCombatSniper.setVisible(true); 
	weaponWindow.buttonCombatSniper.setSize(150.0, 70.0, false); 
	weaponWindow.buttonCombatSniper.setPosition(223.0, y+0.0, false); 
	weaponWindow.buttonCombatSniper.setAlpha(0.0);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("800$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(128.0, y+75.0, false);
	
	weaponWindow.textPrice <- GUIText();
	weaponWindow.textPrice.setText("1000$");
	weaponWindow.textPrice.setParent(weaponWindow.window.getName());
	weaponWindow.textPrice.setVisible(true);
	weaponWindow.textPrice.setSize(100.0, 10.0, false);
	weaponWindow.textPrice.setPosition(298.0, y+75.0, false);
	
	// Status
	
	y += 100.0
	
	weaponWindow.textStatus <- GUIText(); 
	weaponWindow.textStatus.setText("Click weapon image to buy weapon and some ammo."); 
	weaponWindow.textStatus.setParent(weaponWindow.window.getName()); 
	weaponWindow.textStatus.setVisible(true); 
	weaponWindow.textStatus.setSize(600.0, 15.0, false); 
	weaponWindow.textStatus.setPosition(2.5, y, false); 
}
addEvent("makeWeaponBuyBox", onMakeWeaponBuyBox);

function onShowWeaponsBuyWindow(playerCash = 0)
{
	weaponWindow.textCashValue.setText(playerCash.tostring());
	weaponWindow.textStatus.setText(DEFAULT_STATUS_TEXT);
	weaponWindow.window.setVisible(true);
	guiToggleCursor(true);
}
addEvent("showWeaponsBuyWindow", onShowWeaponsBuyWindow);

function onWeaponBuy(status = DEFAULT_STATUS_TEXT, playerCash = 0)
{
	weaponWindow.textCashValue.setText(playerCash.tostring());
	weaponWindow.textStatus.setText(status);
}
addEvent("weaponBuy", onWeaponBuy);

function onButtonClick(btnName, bState)
{
	if(btnName == weaponWindow.buttonBat.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 1, 1);
	}
	else if(btnName == weaponWindow.buttonPoolCue.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 2, 1);
	}
	else if(btnName == weaponWindow.buttonKnife.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 3, 1);
	}
	else if(btnName == weaponWindow.buttonPistol.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 7, 51);
	}
	else if(btnName == weaponWindow.buttonCombatPistol.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 9, 27);
	}
	else if(btnName == weaponWindow.buttonMicroSmg.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 12, 150);
	}
	else if(btnName == weaponWindow.buttonSmg.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 13, 90);
	}
	else if(btnName == weaponWindow.buttonShotgun.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 10, 24);
	}
	else if(btnName == weaponWindow.buttonCombatShotgun.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 11, 30);
	}
	else if(btnName == weaponWindow.buttonAk47.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 14, 90);
	}
	else if(btnName == weaponWindow.buttonM4.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 15, 90);
	}
	else if(btnName == weaponWindow.buttonSniper.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 17, 15);
	}
	else if(btnName == weaponWindow.buttonCombatSniper.getName())
	{ 
		triggerServerEvent("playerBuyWeapon", 16, 30);
	}
}
addEvent("buttonClick", onButtonClick);

function onWindowClose(wndName, wndState)
{
	guiToggleCursor(false);
	triggerServerEvent("playerUnfreeze");
	weaponWindow.window.setVisible(false);
}
addEvent("windowClose", onWindowClose);

